/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.cservice;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.common.i.s;

public class LoadButton extends FrameLayout {
    private boolean a;
    private TextView b;
    private Context c;
    private CustProgressBar d;
    private a e;

    public LoadButton(Context paramContext) {
        this(paramContext, false);
    }

    public LoadButton(Context paramContext, boolean paramBoolean) {
        super(paramContext);
        this.c = paramContext;
        this.a = paramBoolean;
        setEnabled(false);
        d();
    }

    private void d() {
        if (!(this.a)) {
            localLayoutParams = new FrameLayout.LayoutParams(-1, s.b(this.c, 30.0F));
            localLayoutParams.gravity = 17;
            this.b = new TextView(this.c);
            this.b.setGravity(17);
            this.b.setTextColor(-16777216);
            this.b.setLayoutParams(localLayoutParams);
            this.b.setBackgroundColor(-3355444);
            this.b.setOnClickListener(new View.OnClickListener() {
                public void onClick(View paramView) {
                    LoadButton.this.bringChildToFront(LoadButton.a(LoadButton.this));
                    paramView.setVisibility(4);
                    LoadButton.a(LoadButton.this).a();
                    if (LoadButton.b(LoadButton.this) == null)
                        return;
                    LoadButton.b(LoadButton.this).a(paramView, "load_btn_to_load");
                }
            });
            addView(this.b);
        }
        FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(s.b(this.c, 25.0F),
                s.b(this.c, 25.0F));
        localLayoutParams.gravity = 17;
        this.d = new CustProgressBar(this.c, "qihoo_loadingmotion.png");
        this.d.setLayoutParams(localLayoutParams);
        if (!(this.a)) {
            this.d.setVisibility(4);
            this.d.setOnClickListener(new View.OnClickListener() {
                public void onClick(View paramView) {
                    LoadButton.this.bringChildToFront(LoadButton.c(LoadButton.this));
                    LoadButton.a(LoadButton.this).b();
                    LoadButton.c(LoadButton.this).setVisibility(0);
                    if (LoadButton.b(LoadButton.this) == null)
                        return;
                    LoadButton.b(LoadButton.this).a(paramView, "load_btn_to_stop");
                }
            });
        }
        addView(this.d);
    }

    public void setBtnLabel(String paramString) {
        if (this.b == null)
            return;
        this.b.setText(paramString);
    }

    public void a() {
        if (this.a)
            return;
        bringChildToFront(this.b);
        this.d.b();
    }

    public void b() {
        if (this.b != null)
            this.b.setVisibility(8);
        this.d.b();
    }

    public boolean c() {
        if (this.d.getVisibility() != 8)
            return false;
        this.d.a();
        return true;
    }

    public void setOnBtnClickListener(a parama) {
        this.e = parama;
    }

    public static abstract interface a {
        public abstract void a(View paramView, String paramString);
    }
}